package com.example.chatbackend.controller;

import com.example.chatbackend.service.AiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/metrics")
public class MetricsController {
    private final AiService aiService;

    public MetricsController(AiService aiService) {
        this.aiService = aiService;
    }

    @GetMapping("/ai")
    public Map<String, Object> aiMetrics() {
        Map<String, Object> res = new HashMap<>();
        res.put("totalCalls", aiService.getTotalCalls());
        res.put("sessionCalls", aiService.getSessionCallCounts());
        return res;
    }
}


